/**
 * @description: 混入文件
 * @fileName: mixin
 * @author: lhx
 * @date: 2022/4/8-3:02 下午
 * @version: V1.0.0
 **/
export default {
  data() {
    return {
      // 筛选视图是否显示
      searchShow: false,
      // 搜索字段
      search: '',
      searchFormData: {},
      queryForm: {
        page: 1,
        size: 20,
        total: 0
      },
      gridOptions: {
        size: 'small',
        headerAlign: 'center',
        stripe: false,
        border: 'inner', // default full outer inner none
        resizable: true,
        showOverflow: true,
        height: 350,
        showHeaderOverflow: 'tooltip',
        // keepSource: true,
        align: 'center',
        // 添加头部样式
        headerCellClassName: () => {
          return 'header-blue'
        },
        // 关闭虚拟滚动
        scrollX: {
          enabled: false,
          gt: -1
        }
      }
    }
  },
  computed: {
    // 格式化题干信息
    formatterStemInfo: function() {
      return (val) => {
        if (!val) return ''
        // 匹配&{}符号
        const regExp = /\&\{(.*?)\}/
        const result = val.split(regExp)
        // 删除数组里面的空数据
        return this.$baseLodash.pullAll(result, [''])
      }
    }
  },
  methods: {
    queryData() {
      this.queryForm.pageNo = 1
      this.fetchData()
    },
    tableHeight(val) {
      this.$nextTick(() => {
        const _this = this
        _this.gridOptions.height = (document.documentElement.clientHeight - val)
        window.onresize = () => {
          _this.gridOptions.height = (document.documentElement.clientHeight - val)
        }
      })
    }
  },
  created() {
  },
  mounted() {
  }
}
